package schoolWork.Test4;

public class DigitExtraction {
    public static int digitExtraction(String s) {
        int n = 0;

        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (Character.isDigit(c)) {
                if (c == '0' && n == 0)
                    continue;

                n = n * 10 + c - '0';
            }

        }
        return n;
    }
}
